package com.hjqjl.whdemo.feature.feature0.ui.activity.theme;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

import com.hjqjl.whdemo.databinding.ActivityTestslidebackBinding;

/**
 * 侧滑能关闭界面的activity
 */
public class TestSlideBackActivity extends SlideBackActivity {
    public static void start(Context context) {
        Intent starter = new Intent(context, TestSlideBackActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityTestslidebackBinding binding = ActivityTestslidebackBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        binding.homeBtnTestslidebackSwitch.setOnClickListener(v -> {
            if (isOpenSlideBack()) {
                setOpenSlideBack(false);
                binding.homeBtnTestslidebackSwitch.setText("已关闭侧滑关闭本activity功能");
            } else {
                setOpenSlideBack(true);
                binding.homeBtnTestslidebackSwitch.setText("已开启侧滑关闭本activity功能");
            }
        });
    }
}
